﻿#region using statements

using System;

using Microsoft.Xna.Framework;

using NGen.Managers.GameObject;

#endregion

namespace NGen.Managers.Collision
{
	/// <summary>
	/// 	This class is used to populate the current information of an object
	/// 	right during a collision event.  This is useful in that when
	/// 	the first object is notified of a collision; it could change its values
	/// 	before the 2nd object is notified of the collision and attempts
	/// 	to get the first object's information (which has been updated)
	/// 	which would/could result in incorrect calculations.
	/// </summary>
	public struct CollisionMessage2D
	{
		/// <summary>
		/// 	The value of the unique integer identifier for this object at the 
		/// 	time of the collision event
		/// </summary>
		public readonly uint m_objectId;

		/// <summary>
		/// 	The ange value of the object at the time of the collision event, in degrees, 
		/// 	to rotate around the origin
		/// </summary>
		public double m_angle;

		/// <summary>
		/// 	The type of the object collided with
		/// </summary>
		public Type m_objectType;

		/// <summary>
		/// 	The origin of the object at the time of the collision event
		/// </summary>
		public Vector2 m_origin;

		/// <summary>
		/// 	Position of the object on screen at the time of the collision event
		/// </summary>
		public Vector2 m_position;

		/// <summary>
		/// 	This is the default constructor for this class.  It is used to
		/// 	populate the information of the offending gameobject.
		/// </summary>
		/// <param name = "p_objIn">object 2 in a collision with object 1</param>
		public CollisionMessage2D(GameObject2D p_objIn) {
			m_objectId = p_objIn.Id;
			m_origin = p_objIn.m_origin;
			m_position = p_objIn.m_position;
			m_angle = p_objIn.m_angle;
			m_objectType = p_objIn.GetType();
		}
	}
}